package org.javastudy.tang.lambda.stream;

import java.sql.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * <p><em>Created on 2022/5/10 9:51 下午</em></p>
 *
 * @author fuzhongtang
 * @since 1.0.1
 */
public class TestList {
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        for (int i = 0; i < 4; i++) {
            list.add(""+i);
        }

        list.forEach((item) -> System.out.println(item));
        list.forEach( item  -> System.out.println(item));//省略括号
        list.forEach(System.out::println); //最省略

        //lanbda多行代码
        list.forEach((item) -> {
            if (item.startsWith("1"))
            {
                System.out.println("true "+item);
            }
            else
            {
                System.out.println("false "+item);
            }
        });
    }
}
